<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>地图导航</title>
    <style>
        * {
          margin: 0;
          padding: 0;
        }
        #container {
          width: 100%;
          height: 100vh;
        }
    </style>
    <script type="text/javascript">
        window._AMapSecurityConfig = {
          securityJsCode: "69ffd4ce0259015adb9c1461aa63aa59",
        }
    </script>
    <script
            type="text/javascript"
            src="https://webapi.amap.com/maps?v=1.4.15&key=1624c6ac047b12e8828455ea3f35a99b"
    ></script>
</head>
<body>
<div id="container"></div>
<script>
    var map = new AMap.Map("container", {
       zoom: 15, //级别
       center: [116.397428, 39.90923], //中心点坐标
     })
	 
	 window.onload = function () {
		if ( window.shengling){
			window.shengling.getLocation('locationFromHM')
		}
	 }
	 function locationFromHM(lon,lat) {
		map.setZoomAndCenter(18,[lon,lat])
		map.plugin(["AMap.PlaceSearch"], function() {
			var MSearch = new AMap.PlaceSearch({
				pageSize: 4,
				pageIndex: 1, // 请求页码，默认为1
				extensions: "base", // 返回信息详略，默认为base基本信息
			}) // 构造PlaceSearch
			AMap.event.addListener(MSearch,"complete", (result) => {
				shengling.receiveData("search_list" ,JSON.stringify(result?.poiList?.pois || []))
			})// 返回结果
			MSearch.searchNearBy('地点', new AMap.LngLat(lon, lat))
		})
	 }
</script>
</body>
</html>